<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>借阅记录</title>
</head>
<script type="text/javascript">
	function byReader() {
		window.location.href = '${basePath}/record/Record_getRecordCount.action?byType=readerId';
	}
	function byBook() {
		window.location.href = "${basePath}/record/Record_getRecordCount.action?byType=bookId";
	}
</script>
<body>
	<h2>借阅记录列表</h2>
	<input type="button" onclick="javascript:byReader()" value="按读者借阅排行" />
	<input type="button" onclick="javascript:byBook()" value="按图书借阅排行" />
	<hr>
	<table>
		<thead>
			<tr>
				<c:choose>
					<c:when test="${byType =='readerId'}">
						<th>借书册数</th>
						<th>读者编号</th>
						<th>读者姓名</th>
						<th>读者类别</th>
					</c:when>
					<c:otherwise>
						<th>借出次数</th>
						<th>图书编号</th>
						<th>图书名称</th>
						<th>出版社</th>
					</c:otherwise>
				</c:choose>
			</tr>
		</thead>
		<tbody>
			<s:iterator value="list">
				<tr>
					<c:choose>
						<c:when test="${byType =='readerId'}">
							<td><s:property value="readerCount" /></td>
							<td><s:property value="readerId" /></td>
							<td><s:property value="readerName" /></td>
							<td><s:property value="typeName" /></td>
						</c:when>
						<c:otherwise>
							<td><s:property value="bookCount" /></td>
							<td><s:property value="bookId" /></td>
							<td><s:property value="bookName" /></td>
							<td><s:property value="publisherName" /></td>
						</c:otherwise>
					</c:choose>
				</tr>
			</s:iterator>
		</tbody>
	</table>
</body>
</html>
